package com.github.chirspan.xaas.uc.web.api;


import com.github.chirspan.xaas.api.BaseCRUDRestController;
import com.github.chirspan.xaas.core.rest.RestResult;
import com.github.chirspan.xaas.uc.model.OrgAffiliation;
import com.github.chirspan.xaas.uc.service.IOrgAffiliationService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: chenpan
 * @Date: 2021-08-10 11:03:09
 * @Description: 联盟信息 REST API
 */
@RestController
@RequestMapping("affiliation")
public class OrgAffiliationController extends BaseCRUDRestController<OrgAffiliation> {

    @Autowired
    private IOrgAffiliationService affiliationService;

    @GetMapping("/_tree")
    @ApiOperation(value = "树形资源", authorizations = {@Authorization(value = "apiKey")})
    public RestResult tree(OrgAffiliation affiliation) {
        return RestResult.OK(affiliationService.findAffTree(affiliation));
    }
}
